Skip to content

Add desktop app with book library and 4-step flow - #18

Merged
mateogon merged 7 commits into
mainfrom
feat/desktop-ui
Oct 25, 2026
Merged

mateogon merged 7 commits into
mainfrom
feat/desktop-ui

Conversation

@mateogon

@mateogon mateogon commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Builds on #17, which is merged into main.

Summary

A new desktop app replaces the Tk window as the default interface. It is a native window (pywebview over the system web view) with a library of books and a four-step flow: Check text → Pick a voice → Create audio → Export.

Create audio

Changes

Commit What it does
perf: narrate paragraph blocks, not sentences Extraction leaves one sentence per line, and each line was a separate Kokoro call. Lines are now joined into ~450-character blocks per paragraph. 12× real time on MPS instead of 2×, and no extra pause after each sentence. This also speeds up the CLI and the classic window.
feat: add book library and job service library.py: one folder per book with book.json, text, chapter audio and exports; chapter status (done, waiting, needs a redo) from text hashes. jobs.py: one background worker for import, create and export, with pause, stop, measured speed and an activity log. voices.py: readable voice names and the quality grades from Kokoro's VOICES.md.
feat: add pywebview desktop app webui/: native window, a local server on 127.0.0.1 (random port, session token, Range requests, library files only) and the interface. pdf-narrator with no arguments opens it; --ui classic opens the Tk window.
fix: polish library details found in testing Front matter and Gutenberg license skipped, header suggestions without false positives, Chapter N titles for bare numerals, export paths relative to the book, ~ paths, live theme changes.
docs: rewrite README for the desktop app Ordered install and usage steps with a screenshot of each stage, file layout, CLI options, optional setups, troubleshooting and test status.
ci: run checks on stacked pull requests CI runs on every pull request, not only on pull requests to main.
test: keep API tests independent of torch import API tests skip device detection (a torch import) and wait up to 60 s, which fixed a timing failure on Ubuntu CI.

Evidence

  • uv run --locked --group dev pytest -q → 130 passed, 2 skipped, 12 subtests passed (the 2 skips are optional OCR dependencies, as before).
  • New tests: library and chapter status, jobs (pause, stop, resume, redo of edited chapters, M4B/MP3 export, samples), local server (token, path traversal, Range), the JavaScript API bridge, speech blocks.
  • Manual end-to-end on macOS (Apple M-series, MPS) in the native window:
    • Imported EPUB, PDF and TXT books; covers, authors and languages detected.
    • Voice samples with a paragraph from the book.
    • Created 20 minutes of audio in 2 min 15 s; pause and stop work.
    • Exported M4B checked with ffprobe: 2 chapters with real titles, cover, title and author.
  • The README screenshots come from the native window with public-domain books (Standard Ebooks Pride and Prejudice, Gutenberg The Happy Prince).

Not verified

  • The desktop app on Windows and Linux. CI runs the tests on all three systems, but the window itself was only used on macOS. On Linux, the README documents the GTK setup and marks it as not tested.
  • Drag and drop into the native window (import was tested through the file dialog path and the API).
  • MP3 export from the window (covered by a unit test).

Follow-ups

  • EPUB extraction splits inline tags into separate lines (for example, Mr. becomes Mister on its own line). Speech is not affected, because lines are joined into blocks, but the text in Check text looks broken.
  • PDFs without a table of contents become one chapter. Papers could split by section headings and skip references.
  • Remove the classic Tk window and ttkbootstrap after the new app is tested on Windows and Linux.

🤖 Generated with Claude Code

mateogonzalez-ppg and others added 7 commits October 25, 2026 14:08
Extraction leaves about one sentence per line, and each line became a
separate Kokoro call. Join lines into ~450-character blocks per
paragraph: 12x real time on MPS instead of 2x, without a pause after
every sentence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Library keeps one folder per book with book.json, text, chapter audio
and exports. JobService runs import, create and export jobs on one
worker with pause, stop, measured speed and an activity log. Voice
samples run on their own thread with a cached pipeline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A desktop window with a library and a four-step book flow: check text,
pick a voice, create audio and export. A local server on 127.0.0.1
serves the app and library media with a session token and Range
support. The Tk window stays available with --ui classic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Skip Standard Ebooks front matter, ignore single-word header tips,
title bare numerals as Chapter N, store export paths relative to the
book, show home paths as ~, apply theme changes live and format
numbers in English. PDF_NARRATOR_CONFIG_DIR moves the settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ordered install and usage steps with screenshots of each stage,
file layout, command line options, optional setups, troubleshooting
and test status. Replace the old Tk screenshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Device detection imports torch in a thread. On CI it slowed the import
job past the 10 s helper limit, so remove_book saw a running job.
Tests now skip detection and wait up to 60 s with a clear failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mateogon
mateogon changed the base branch from codex/renovacion-local to main October 25, 2026 17:56
@mateogon
mateogon merged commit b44c250 into main Oct 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants